package com.liuchuanzheng.lcz_compose_news.utils

import android.content.Context
import android.content.SharedPreferences
import com.liuchuanzheng.lcz_compose_news.mApp

/**
 * @author 刘传政
 * @date 2021/8/2 9:08
 * QQ:1052374416
 * 电话:18501231486
 * 作用:
 * 注意事项:
 */
object SpUtils {
    private const val SP_FILE_NAME = "sp_news_file"

    private val prefs: SharedPreferences by lazy {
        mApp.getSharedPreferences(SP_FILE_NAME, Context.MODE_PRIVATE)
    }

    fun getBoolean(name: String): Boolean = prefs.getBoolean(name, false)

    fun setBoolean(name: String, value: Boolean) {
        with(prefs.edit()) {
            putBoolean(name, value)
            apply()
        }
    }
}